import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userInfo:''
  },
  getters: {
  },
  mutations: {
    setUserInfo(state,userInfo){
      state.userInfo = userInfo
    },
    getUserInfo(state){
      return state.userInfo
    },
    logOut(state){
      state.userInfo = ''
    }
  },
  actions: {
    setUserInfoAsync(context,userInfo){
      context.commit('setUserInfo',userInfo)
    },
    logOutAsync(context){
      context.commit('logOut')
    }
  },
  modules: {
  },
  plugins: [createPersistedState()]
})
